package com.project.controller;

import com.project.bean.SalesStatisticsBean;
import com.project.service.ISalesStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

@RestController
@RequestMapping("statistics")
public class SalesStatisticsController {
    @Autowired
    private ISalesStatisticsService service;
@RequestMapping("findByType")
    public List<SalesStatisticsBean> findByType(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate){
        return service.findByType(startDate,endDate);
    }
@RequestMapping("findByGoods")
    public List<SalesStatisticsBean> findByGoods(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,@DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate){
    return service.findByGoods(startDate,endDate);
    }
}
